#define _CRT_SECURE_NO_WARNINGS
class MinStack {
public:
    MinStack() {

    }

    void push(int val) {
        st.push(val);
        if (minst.empty() || st.top() <= minst.top())
            minst.push(val);
    }

    void pop() {
        if (!minst.empty() && st.top() == minst.top())
            minst.pop();
        st.pop();
    }

    int top() {
        return st.top();

    }

    int getMin() {
        return minst.top();
    }
private:
    stack<int> st;
    stack<int> minst;
};

/**
 * Your MinStack object will be instantiated and called as such:
 * MinStack* obj = new MinStack();
 * obj->push(val);
 * obj->pop();
 * int param_3 = obj->top();
 * int param_4 = obj->getMin();
 */